import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { Provider } from 'react-redux';

import AppRouter from '@/AppRouter';
import TopErrorBoundary from '@/shared/components/TopErrorBoundary';
import store from '@/shared/redux/store';

import '@/index.css';

// Beginning with React 18, when in development mode, the components will be mounted, unmounted, and then mounted once again in StrictMode.
// This only occurs in the development mode; it does not occur in the production mode.
// Official documentation strongly recommends DO NOT disable StrictMode.
createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <TopErrorBoundary>
      <Provider store={store}>
        <AppRouter />
      </Provider>
    </TopErrorBoundary>
  </StrictMode>,
);
